﻿@inject ContentService contentService
@model PagedInfo<ViewContentAndCate>
@{
    ViewData["Title"] = await SystemConfig.GetByFieldNameAsync("SiteName");
}

<div class="layui-container">
    <div class="layui-row  layui-col-space15">
        <div class="layui-col-md9">
            <div class="layui-card">
                <div class="layui-card-header">Blog Index</div>
                <div class="layui-card-body">
                    <div class="layui-col-md12">
                        @foreach (var item in Model.Result)
                        {
                            <div class="layui-panel cxuu-panel">
                                [<a href="/Home/List/Index/@item.Cid">
                                    @(item.CateName)
                                </a>]
                               <a href="/Home/Info/Index/@item.Id" target="_blank">@item.Title </a><span class="float-right">@item.Time.ToString("d")</span>
                            </div>
                        }
                    </div>
                </div><div id="laypage"></div>
            </div>
            
        </div>
        <div class="layui-col-md3">
            <div class="layui-card">
                <div class="layui-card-header"> HOT List</div>
                <div class="layui-card-body">
                    <ul class="list-group list-group-flush">
                        @foreach (var item in await contentService.QyList(new() { Cids = null, Limit = 10, CacheName = "indexAll" }))
                        {
                            <li class="list-group-item">
                                [<a href="/Home/List/Index/@item.Cid">
                                    @(item.CateName)
                                </a>]
                                <a href="/Home/Info/Index/@item.Id" target="_blank">@item.Title </a>
                            </li>
                        }
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>
@section Scripts
    {
<script>
    layui.use(['laypage', 'element', 'layer'], function () {
        var laypage = layui.laypage
            , layer = layui.layer
            , laypage = layui.laypage
            , element = layui.element;

        laypage.render({
            elem: 'laypage'
            , count: '@Model.TotalNum'
            , limit: 15
            , groups: '@Model.TotalPage'
            , theme: '#1E9FFF'
            , curr: '@Model.PageSize' //获取起始页
            //,hash: '/' //自定义hash值
            , prev: "上一页"
            , next: "下一页"
            , jump: function (obj, first) {
                if (!first) {
                    location.href = '/Home/Content/Index/?page=' + obj.curr;
                }
            }
        });
    });
    
</script>
}